package com.xxxx.spring.test.jdkTest.test02;

import java.lang.reflect.Method;

public class $Proxy01 implements Foo {

    private InvocationHandler h;

    public $Proxy01(InvocationHandler h){
        this.h = h;
    }

    @Override
    public void hello() {
        System.out.println("我是代理方法hello()");
        try {
            Method hello = Foo.class.getMethod("hello");
            h.invoke(hello,new Object[0]);
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }

    @Override
    public void say() {
        System.out.println("我是代理方法say()");
        try {
            Method say = Foo.class.getMethod("say");
            h.invoke(say,new Object[0]);
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
}
